package org.example.use;

import com.li.annotation.RpcReference;
import com.li.config.RpcServiceConfig;
import com.li.proxy.RpcClientProxy;
import com.li.service.HelloService;
import com.li.transport.client.RpcClient;
import org.springframework.stereotype.Component;

@Component
public class Client {
//    @RpcReference(group = "groupLi",version = "version3")
//    public static HelloService service;
    public static void main(String[] args) {
        RpcClient rpcClient = new RpcClient();
        RpcServiceConfig rpcServiceConfig = new RpcServiceConfig();
        rpcServiceConfig.setGroup("groupLi");
        rpcServiceConfig.setVersion("version1");

        RpcClientProxy rpcClientProxy = new RpcClientProxy(rpcClient,rpcServiceConfig);
        HelloService service = rpcClientProxy.getProxy(HelloService.class);
        System.out.println(service.sayHello("zhangsan"));
    }
//    public void doMain(){
//        System.out.println(service.sayHello("zhangsan"));
//    }
}
